Carbon


SetComponentRefcon

Header: Components.h Carbon status: Supported

Sets the reference constant for your component.

void SetComponentRefcon (
    Component aComponent, 
    SInt32 theRefcon
);
Parameter descriptions
aComponent

The component whose reference constant you wish to set. You can use a component instance here, but you must coerce the data type appropriately.

theRefcon

The reference constant value that you want to set for your component. Your component can retrieve the reference constant using the GetComponentRefcon function.

DISCUSSION

There is one reference constant for each component, regardless of the number of connections to that component. When your component is registered, the Component Manager sets this reference constant to 0.

The reference constant is a 4-byte value that your component can use in any way you decide. For example, you might use the reference constant to store the address of a data structure that is shared by all connections maintained by your component. You should allocate shared structures in the system heap. Your component should deallocate the structure when its last connection is closed or when it is unregistered.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)